package com.zmx.patients.adapter;

import android.app.Activity;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.wang.adapters.adapter.BaseAdapterRvList;
import com.wang.adapters.base.BaseViewHolder;
import com.zmx.patients.R;
import com.zmx.patients.pojo.Doctor;

import butterknife.BindView;
import butterknife.ButterKnife;

public class DoctorItemAdapter extends BaseAdapterRvList<DoctorItemAdapter.ViewHolder, Doctor> {

    public DoctorItemAdapter(Activity activity) {
        super(activity);
    }

    @Override
    protected void onBindVH(ViewHolder holder, int listPosition, Doctor doctor) {

        holder.name.setText(doctor.getName());
        holder.describe.setText(doctor.getTitle_name());
        holder.addres.setText(doctor.getClass_name());
        holder.bei.setText(doctor.getExpertise());
        holder.price.setText(Html.fromHtml("图文"+"<font color='#FF0000'>￥"+doctor.getImgtextfee()+"</font>" +"    挂号"+"<font color='#FF0000'>￥"+68+"</font>" +"    电话"+"<font color='#FF0000'>￥"+88+"</font>"));
        Glide.with(mActivity).load(doctor.getAvatar()).into(holder.head);

    }

    @NonNull
    @Override
    protected ViewHolder onCreateVH(ViewGroup parent, LayoutInflater inflater) {

        ViewHolder holder = new ViewHolder(inflater.inflate(R.layout.adapter_doctor, parent, false));
        return holder;

    }

    static class ViewHolder extends BaseViewHolder {

        @BindView(R.id.head)
        ImageView head;
        @BindView(R.id.name)
        TextView name;
        @BindView(R.id.describe)
        TextView describe;
        @BindView(R.id.addres)
        TextView addres;
        @BindView(R.id.members_number)
        TextView membersNumber;
        @BindView(R.id.bei)
        TextView bei;
        @BindView(R.id.price)
        TextView price;

        ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }

    }

}
